<template>
  <div class="type-nav">
    <div class="nav-left">
      <div class="left-top">
        <div class="avatar">
          <img src="../../../assets/avatar.jpeg" alt="" />
        </div>
        <span>abc888</span>
      </div>
      <div class="left-bottom">
        <div class="items">
          <ul>
            <li
              @click="btnClick(index)"
              v-for="(item, index) in list"
              :class="{ active: currentIndex === index }"
              :key="item"
            >
              <a>{{ item }}</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "TypeNav",
  data() {
    return {
      activeName: "first",
      list: [
        "我的订单",
        "账户资料",
        "收货地址",
        "我的优惠",
        "售后服务",
        "以旧换新",
      ],
      flag: false,
      currentIndex: "",
    };
  },
  methods: {
    btnClick(index) {
      this.currentIndex = index;
      switch (index) {
        case 0:
          this.$router.push("/orderList");
          break;
        case 1:
          this.$router.push("/information");
          break;
        case 2:
          this.$router.push("/addressList");
          break;
        case 3:
          this.$router.push("/coupon");
          break;
        case 4:
          this.$router.push("/support");
          break;
        case 5:
          this.$router.push("/aihuishou");
          break;
        default:
          break;
      }
      // this.$router.push('/orderList')
    },
  },
};
</script>

<style lang="less" scoped>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.type-nav {
  border-radius: 8px 8px 8px 8px;
  width: 210px;
  // height: 540px;
  background-color: #ffffff;
  .nav-left {
    .left-top {
      text-align: center;
      padding-top: 20px;
      .avatar {
        margin-bottom: 10px;
        img {
          width: 160px;
          height: 160px;
        }
      }
    }
    .left-bottom {
      margin-top: 30px;
      .items {
        text-align: center;
        ul {
          margin: 0;
          padding: 0;
          list-style: none;
          text-align: center;
          .active {
            background-color: #98afee;
            a {
              color: #fff;
            }
          }
          li {
            height: 48px;
            line-height: 48px;
            color: #98afee;
            border-top: 1px solid #ebebeb;
            a {
              text-decoration: none;
              color: #98afee;
            }
          }
          li:hover {
            background-color: #98afee;
            a {
              color: #fff;
            }
          }
        }
      }
    }
  }
}
</style>
